package com.baby.api;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.baby.feign.FeignClients;
import com.baby.service.UserService;
import com.baby.service.WeChatService;
import com.thoughtworks.xstream.XStream;
import com.youyicloud.constants.Constants;
import com.youyicloud.entity.UserInfo;
import com.youyicloud.po.H5Pay;
import com.youyicloud.po.UnifiedOrder;
import com.youyicloud.po.WeChatNotifyInfo;
import com.youyicloud.po.WechatPayInfo;
import com.youyicloud.utils.DateUtils;
import com.youyicloud.utils.HttpsRequestUtil;
import com.youyicloud.utils.JWTUtil;
import com.youyicloud.utils.VerifySignUtil;
import com.youyicloud.wechat.sdk.WXPayUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
import me.chanjar.weixin.mp.bean.result.WxMpUser;

@Controller
@Slf4j
@SuppressWarnings({"rawtypes","unchecked"})
@Api(value="微信接口")
public class WeChatApi {
	
	@Value("${appId}")
	private String appId;
	@Value("${appSecret}")
	private String appSecret;
	@Value("${callBackUrl}")
	private String callBackUrl;
	@Value("${goToIndexUrl}")
	private String goToIndexUrl;
	@Value("${jsapiUrl}")
	private String jsapiUrl;
	@Value("${weChatNotifyUrl}")
	private String weChatNotifyUrl;
	
	@Value("${weChatNotifyUrl2}")
	private String weChatNotifyUrl2;
	
	@Value("${mchId}")
	private String mchId;
	@Value("${key}")
	private String key;
	
	
	@Value("${wxPayAppid}")
	private String wxPayAppid;
	@Value("${wxPayMchId}")
	private String wxPayMchId;
	@Value("${wxPayKey}")
	private String wxPayKey;
	
	@Autowired
	private UserService userService;
	@Autowired
	private FeignClients feignClients;
	@Autowired
	private WxMpService wxMpService;
	@Autowired
	private WeChatService weChatService;
	
	@Value("${shareIcon}")
	private String shareIcon;
	
	@ApiOperation("微信网页授权")
	@RequestMapping(value="/authorize",method= {RequestMethod.GET,RequestMethod.POST})
	public String authorize(){
		String redirectUrl = wxMpService.oauth2buildAuthorizationUrl(callBackUrl, WxConsts. OAuth2Scope.SNSAPI_USERINFO, null);
		log.info("微信网页授权....,地址:{}",redirectUrl);
		return "redirect:"+redirectUrl;
	}
	
	@ApiOperation("获取微信OpenId")
	@GetMapping("/getOpenId")
	public String getOpenId(RedirectAttributes attr,@RequestParam("code") String code,
			@RequestParam("state") String returnUrl) throws Exception{
		WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
		try {
			wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
		} catch (WxErrorException e) {
			log.error("微信网页授权异常{}",e);
			throw new Exception();
		}
		String openId = wxMpOAuth2AccessToken.getOpenId();
		WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(wxMpOAuth2AccessToken, null);
		log.info("微信登录获取的信息:{}",wxMpUser.toString());
		log.info("获取openId:{}....",openId);
		UserInfo userInfo = feignClients.findByOpenId(openId);
		String token = JWTUtil.sign(userInfo.getUserId()+"",userInfo.getPassword());
		return "redirect:"+goToIndexUrl+"?userId="+userInfo.getUserId()+"&openId="+openId+"&token="+token;
	}
	
	@RequestMapping("goToIndex")
	public String goToIndex(Integer userId,Model model) {
		UserInfo userInfo = feignClients.findUserById(userId);
		String token = JWTUtil.sign(userInfo.getUserId()+"",userInfo.getPassword());
		return "redirect:"+goToIndexUrl+"?userId="+userId+"&openId="+userInfo.getOpenId()+"&token="+token;
	}
	
	/**
	 * 微信服务器认证地址
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@ApiOperation("微信服务器认证地址")
	@RequestMapping(value="/checkWebcatId",method= {RequestMethod.GET,RequestMethod.POST})
	public void checkWebcatId(HttpServletRequest request, HttpServletResponse response) throws Exception{
		boolean isGet = request.getMethod().toLowerCase().equals("get");
        PrintWriter print;
        if (isGet) {
            // 微信加密签名
            String signature = request.getParameter("signature");
            // 时间戳
            String timestamp = request.getParameter("timestamp");
            // 随机数
            String nonce = request.getParameter("nonce");
            // 随机字符串
            String echostr = request.getParameter("echostr");
            log.info("微信服务器认证地址.....加密签名:{},时间戳:{},随机数:{},随机字符串:{}",signature,timestamp,nonce,echostr);
            // 通过检验signature对请求进行校验，若校验成功则原样返回echostr，表示接入成功，否则接入失败
            if (signature != null && VerifySignUtil.checkSignature(signature, timestamp, nonce)) {
                try {
                    print = response.getWriter();
                    print.write(echostr);
                    print.flush();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
	    }
	}
	
	/**
	 * 微信支付唤起
	 * @throws Exception
	 * eg:opid:ozotW04PBgzjj_1c1_HzoJoh4sb4
	 */
	@RequestMapping(value="/weChatPay",method= {RequestMethod.GET,RequestMethod.POST})
	public String weChatPay(Model model,HttpServletRequest request) throws Exception{
		String openId = "ozotW04PBgzjj_1c1_HzoJoh4sb4";
		String ip = request.getHeader("X-Real-IP");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			return ip;
		}
		ip = request.getHeader("X-Forwarded-For");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			// 多次反向代理后会有多个IP值，第一个为真实IP。
			int index = ip.indexOf(',');
			if (index != -1) {
				ip = ip.substring(0, index);
			}
		} else {
			ip = request.getRemoteAddr();
		}
		XStream xStream = new XStream();
		UnifiedOrder unifiedOrder = new UnifiedOrder();
		String nonceStr = WXPayUtil.generateNonceStr();
		unifiedOrder.setAppid(appId);
		unifiedOrder.setNonce_str(nonceStr);
		unifiedOrder.setMch_id(mchId);
		unifiedOrder.setSpbill_create_ip(ip);
		unifiedOrder.setDevice_info("H5");
		unifiedOrder.setBody("微信支付测试");
		unifiedOrder.setTrade_type("JSAPI");
		unifiedOrder.setNotify_url(weChatNotifyUrl);
		Integer totalFee = 1;
		unifiedOrder.setTotal_fee(totalFee);
		unifiedOrder.setOpenid(openId);
		String outTradeNo = WXPayUtil.generateUUID();
		unifiedOrder.setOut_trade_no(outTradeNo);
		Map requestMap = new HashMap();
		requestMap = BeanUtils.describe(unifiedOrder);
		requestMap.remove("class");
		String sign = WXPayUtil.generateSignature(requestMap, key);
    	
    	unifiedOrder.setSign(sign);
    	xStream.alias("xml", UnifiedOrder.class);
    	String xmlStr = xStream.toXML(unifiedOrder).replaceAll("__", "_");
        System.out.println(xmlStr);
        
        String requestUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder";
		String respxml=null;
		String prepay_id=null;
		
		try {
			respxml = HttpsRequestUtil.HttpsRequest(requestUrl, "POST",xmlStr);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		xStream.alias("xml", H5Pay.class);
		H5Pay h5Pay = new H5Pay();
		
		Map resultMap = WXPayUtil.xmlToMap(respxml);
		BeanUtils.populate(h5Pay, resultMap);
		
		prepay_id = "prepay_id="+h5Pay.getPrepay_id();
		h5Pay.setPrepay_id(prepay_id);
		String timeStamp = new Date().getTime()/1000+"";
		
		SortedMap h5RequestMap = new TreeMap();
		h5RequestMap.put("appId", appId);
		h5RequestMap.put("timeStamp", timeStamp);
		h5RequestMap.put("nonceStr", nonceStr);
		h5RequestMap.put("package", prepay_id);
		h5RequestMap.put("signType", "MD5");
		
		String paySign = WXPayUtil.generateSignature(h5RequestMap, key);
		
		
		WechatPayInfo wechatPayInfo = new WechatPayInfo();
		wechatPayInfo.setMchId(mchId);
		wechatPayInfo.setOutTradeNo(outTradeNo);
		wechatPayInfo.setOpenId(openId);
		wechatPayInfo.setTotalFee(totalFee);
		wechatPayInfo.setState(Constants.NON_PAYMENT);
		wechatPayInfo.setUpdateTime(DateUtils.getNowDate());
		weChatService.saveWechatPay(wechatPayInfo);
		
		log.info("H5签名参数：{}",h5RequestMap);
		model.addAttribute("appIdStr", appId);
		model.addAttribute("timeStampStr", timeStamp);
		model.addAttribute("nonceStr", nonceStr);
		model.addAttribute("packageStr", prepay_id);
		model.addAttribute("signTypeStr", "MD5");
		model.addAttribute("paySignStr", paySign);
		
		return "wechatPay";
	}
	
	/**
	 * 微信支付唤起获取信息
	 * @throws Exception
	 * eg:opid:ozotW04PBgzjj_1c1_HzoJoh4sb4	ozotW04PBgzjj_1c1_HzoJoh4sb4吴小帆的opendiD
	 */
	@ApiOperation("微信支付唤起获取信息-H5")
	@RequestMapping(value="/getWeChatPay",method= {RequestMethod.GET,RequestMethod.POST})
	public @ResponseBody Map weChatPay(HttpServletRequest request,String openId,String totalFree,String userId,String prizeIds,
			Integer orderId,
			String enumTypeId,String dicDataCode,Integer spaceCount,
			String token) throws Exception{
		Map returnMap = new HashMap();
		String ip = request.getHeader("X-Real-IP");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			return returnMap;
		}
		ip = request.getHeader("X-Forwarded-For");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			// 多次反向代理后会有多个IP值，第一个为真实IP。
			int index = ip.indexOf(',');
			if (index != -1) {
				ip = ip.substring(0, index);
			}
		} else {
			ip = request.getRemoteAddr();
		}
		XStream xStream = new XStream();
		UnifiedOrder unifiedOrder = new UnifiedOrder();
		String nonceStr = WXPayUtil.generateNonceStr();
		unifiedOrder.setAppid(appId);
		unifiedOrder.setNonce_str(nonceStr);
		unifiedOrder.setMch_id(mchId);
		unifiedOrder.setSpbill_create_ip(ip);
		unifiedOrder.setDevice_info("H5");
		unifiedOrder.setBody("微信支付测试");
		unifiedOrder.setTrade_type("JSAPI");
		
		if (StringUtils.isEmpty(prizeIds)) {
			unifiedOrder.setNotify_url(weChatNotifyUrl);//回调地址
		}else {
			unifiedOrder.setNotify_url(weChatNotifyUrl2);//回调地址
		}
		
		Integer totalFee = Integer.parseInt(totalFree);
		unifiedOrder.setTotal_fee(totalFee);
		unifiedOrder.setOpenid(openId);
		String outTradeNo = WXPayUtil.generateUUID();
		unifiedOrder.setOut_trade_no(outTradeNo);
		Map requestMap = new HashMap();
		requestMap = BeanUtils.describe(unifiedOrder);
		requestMap.remove("class");
		String sign = WXPayUtil.generateSignature(requestMap, key);
    	
    	unifiedOrder.setSign(sign);
    	xStream.alias("xml", UnifiedOrder.class);
    	String xmlStr = xStream.toXML(unifiedOrder).replaceAll("__", "_");
        System.out.println(xmlStr);
        
        String requestUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder";
		String respxml=null;
		String prepay_id=null;
		
		try {
			respxml = HttpsRequestUtil.HttpsRequest(requestUrl, "POST",xmlStr);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		xStream.alias("xml", H5Pay.class);
		H5Pay h5Pay = new H5Pay();
		
		Map resultMap = WXPayUtil.xmlToMap(respxml);
		BeanUtils.populate(h5Pay, resultMap);
		
		prepay_id = "prepay_id="+h5Pay.getPrepay_id();
		h5Pay.setPrepay_id(prepay_id);
		String timeStamp = new Date().getTime()/1000+"";
		
		SortedMap h5RequestMap = new TreeMap();
		h5RequestMap.put("appId", appId);
		h5RequestMap.put("timeStamp", timeStamp);
		h5RequestMap.put("nonceStr", nonceStr);
		h5RequestMap.put("package", prepay_id);
		h5RequestMap.put("signType", "MD5");
		
		String paySign = WXPayUtil.generateSignature(h5RequestMap, key);
		WechatPayInfo wechatPayInfo = new WechatPayInfo();
		wechatPayInfo.setMchId(mchId);
		wechatPayInfo.setOutTradeNo(outTradeNo);
		wechatPayInfo.setDicDataCode(dicDataCode);
		wechatPayInfo.setEnumTypeId(enumTypeId);
		wechatPayInfo.setOpenId(openId);
		wechatPayInfo.setTotalFee(totalFee);
		wechatPayInfo.setState(Constants.NON_PAYMENT);
		wechatPayInfo.setCreateUser(userId);
		wechatPayInfo.setUpdateUser(userId);
		wechatPayInfo.setUpdateTime(DateUtils.getNowDate());
		wechatPayInfo.setCreateTime(DateUtils.getNowDate());
		
		weChatService.saveWechatPay(wechatPayInfo);
		
		log.info("H5签名参数：{}",h5RequestMap);
		/*model.addAttribute("appIdStr", appId);
		model.addAttribute("timeStampStr", timeStamp);
		model.addAttribute("nonceStr", nonceStr);
		model.addAttribute("packageStr", prepay_id);
		model.addAttribute("signTypeStr", "MD5");
		model.addAttribute("paySignStr", paySign);*/
		returnMap.put("appIdStr", appId);
		returnMap.put("timeStampStr", timeStamp);
		returnMap.put("nonceStr", nonceStr);
		returnMap.put("packageStr", prepay_id);
		returnMap.put("signTypeStr", "MD5");
		returnMap.put("paySignStr", paySign);
		returnMap.put("token", token);
		return returnMap;
	}
	
	/**
	 * APP微信支付唤起获取信息
	 * @throws Exception
	 * eg:opid:ozotW04PBgzjj_1c1_HzoJoh4sb4	ozotW04PBgzjj_1c1_HzoJoh4sb4吴小帆的opendiD
	 */
	@ApiOperation("APP微信支付唤起获取信息")
	@RequestMapping(value="/getWeChatPayApp",method= {RequestMethod.GET,RequestMethod.POST})
	public @ResponseBody Map getWeChatPayApp(HttpServletRequest request,String totalFree,String userId,String prizeIds,
			Integer orderId,
			String enumTypeId,String dicDataCode,Integer spaceCount,
			String token) throws Exception{
		Map returnMap = new HashMap();
		String ip = request.getHeader("X-Real-IP");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			return returnMap;
		}
		ip = request.getHeader("X-Forwarded-For");
		if (!StringUtils.isBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
			// 多次反向代理后会有多个IP值，第一个为真实IP。
			int index = ip.indexOf(',');
			if (index != -1) {
				ip = ip.substring(0, index);
			}
		} else {
			ip = request.getRemoteAddr();
		}
		XStream xStream = new XStream();
		UnifiedOrder unifiedOrder = new UnifiedOrder();
		String nonceStr = WXPayUtil.generateNonceStr();
		
		
		unifiedOrder.setAppid(wxPayAppid);//appID
		unifiedOrder.setMch_id(wxPayMchId);//商户号
		unifiedOrder.setDevice_info("APP");//设备号
		unifiedOrder.setNonce_str(nonceStr);//随机字符串
		unifiedOrder.setBody("APP微信支付测试");//商品描述
		
		String outTradeNo = WXPayUtil.generateUUID();
		unifiedOrder.setOut_trade_no(outTradeNo);//商户订单号
		unifiedOrder.setSpbill_create_ip(ip);//终端IP
		if (StringUtils.isEmpty(prizeIds)) {
			unifiedOrder.setNotify_url(weChatNotifyUrl);//回调地址
		}else {
			unifiedOrder.setNotify_url(weChatNotifyUrl2);//回调地址
		}
		
		unifiedOrder.setTrade_type("APP");//支付类型
		
		totalFree = "1";
		
		Integer totalFee = Integer.parseInt(totalFree);
		unifiedOrder.setTotal_fee(totalFee);//总金额
		
		Map requestMap = new HashMap();
		requestMap = BeanUtils.describe(unifiedOrder);
		requestMap.remove("class");
		String sign = WXPayUtil.generateSignature(requestMap, wxPayKey);
    	unifiedOrder.setSign(sign);//签名
    	
    	xStream.alias("xml", UnifiedOrder.class);
    	String xmlStr = xStream.toXML(unifiedOrder).replaceAll("__", "_");
       
        
        String requestUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder";
		String respxml=null;
		
		try {
			respxml = HttpsRequestUtil.HttpsRequest(requestUrl, "POST",xmlStr);
		} catch (Exception e) {
			e.printStackTrace();
		}
		xStream.alias("xml", H5Pay.class);
		H5Pay h5Pay = new H5Pay();
		
		Map resultMap = WXPayUtil.xmlToMap(respxml);
		BeanUtils.populate(h5Pay, resultMap);
		
		String timeStamp = new Date().getTime()/1000+"";
		
		SortedMap h5RequestMap = new TreeMap();
		
		h5RequestMap.put("appid", wxPayAppid);
		h5RequestMap.put("partnerid", wxPayMchId);
		h5RequestMap.put("prepayid", h5Pay.getPrepay_id());
		h5RequestMap.put("package", "Sign=WXPay");
		String noncestr = WXPayUtil.generateNonceStr();
		h5RequestMap.put("noncestr", noncestr);
		h5RequestMap.put("timestamp", timeStamp);
		
		String paySign = WXPayUtil.generateSignature(h5RequestMap, wxPayKey);//支付签名
		log.info("APP签名参数：{}",h5RequestMap);
		
		//保存订单到数据库
		WechatPayInfo wechatPayInfo = new WechatPayInfo();
		wechatPayInfo.setMchId(wxPayMchId);
		wechatPayInfo.setOutTradeNo(outTradeNo);
		wechatPayInfo.setTotalFee(totalFee);
		wechatPayInfo.setState(Constants.NON_PAYMENT);
		wechatPayInfo.setDicDataCode(dicDataCode);
		wechatPayInfo.setEnumTypeId(enumTypeId);
		wechatPayInfo.setCreateUser(userId);
		wechatPayInfo.setUpdateUser(userId);
		wechatPayInfo.setUpdateTime(DateUtils.getNowDate());
		wechatPayInfo.setCreateTime(DateUtils.getNowDate());
		weChatService.saveWechatPay(wechatPayInfo);
		
		returnMap.put("appIdStr", wxPayAppid);
		returnMap.put("timeStampStr", timeStamp);
		returnMap.put("nonceStr", noncestr);
		returnMap.put("packageStr", h5Pay.getPrepay_id());
		returnMap.put("signTypeStr", "MD5");
		returnMap.put("paySignStr", paySign);
		returnMap.put("token", token);
		return returnMap;
	}
	
	
	/**
	 * 微信支付的回调
	 */
	@ApiOperation("微信支付的回调")
	@RequestMapping(value="weChatNotify",method= {RequestMethod.GET,RequestMethod.POST})
	public @ResponseBody Map weChatNotify(HttpServletRequest request) {
		Map resultMap = new HashMap();
		String wxNotifyXml = "";
		DataInputStream in = null;
		try {
			in = new DataInputStream(request.getInputStream());
			byte[] dataOrigin = new byte[request.getContentLength()];
			in.readFully(dataOrigin); // 根据长度，将消息实体的内容读入字节数组dataOrigin中

			if (null != in) {
				in.close(); // 关闭数据流
			}
			wxNotifyXml = new String(dataOrigin); // 从字节数组中得到表示实体的字符串
			WeChatNotifyInfo weChatNotifyInfo = new WeChatNotifyInfo();
			Map notifyMap = WXPayUtil.xmlToMap(wxNotifyXml);
			BeanUtils.populate(weChatNotifyInfo, notifyMap);
			
			
			log.error("微信回调数据:{}",weChatNotifyInfo);
			
			WechatPayInfo wechatPayInfo = weChatService.findByMchIdAndOutTradeNo(weChatNotifyInfo.getMch_id(), 
					weChatNotifyInfo.getOut_trade_no());
			
			log.info("微信回调信息:{}",weChatNotifyInfo);
		} catch (Exception e) {
			e.printStackTrace();
			log.error("微信回调异常:{}",e);
		}
		return resultMap;
	}
	
	
	
	@RequestMapping("/")
	public String share(Model model,String v) {
//		String jsapiTicket = commonFeignClient.getJsapiTicket(appId,appSecret);
//		Map<String, String> map = SignUtil.sign(jsapiTicket, jsapiUrl);
//		System.out.println("jsapiTicket："+ jsapiTicket);
//		System.out.println("签名参数："+JSON.toJSONString(map));
//		
//		model.mergeAttributes(map);
//		model.addAttribute("appId", appId);
		return "hello";
	}
	

	
	
	
	
	/**
	 * 配送微信支付的回调
	 */
	@ApiOperation("配送微信支付的回调")
	@RequestMapping(value="weChatNotify2",method= {RequestMethod.GET,RequestMethod.POST})
	public @ResponseBody Map weChatNotify2(HttpServletRequest request) {
		Map resultMap = new HashMap();
		String wxNotifyXml = "";
		DataInputStream in = null;
		try {
			in = new DataInputStream(request.getInputStream());
			byte[] dataOrigin = new byte[request.getContentLength()];
			in.readFully(dataOrigin); // 根据长度，将消息实体的内容读入字节数组dataOrigin中

			if (null != in) {
				in.close(); // 关闭数据流
			}
			wxNotifyXml = new String(dataOrigin); // 从字节数组中得到表示实体的字符串
			WeChatNotifyInfo weChatNotifyInfo = new WeChatNotifyInfo();
			Map notifyMap = WXPayUtil.xmlToMap(wxNotifyXml);
			BeanUtils.populate(weChatNotifyInfo, notifyMap);
			
			log.error("微信回调数据:{}",weChatNotifyInfo);
			
			WechatPayInfo wechatPayInfo = weChatService.findByMchIdAndOutTradeNo(weChatNotifyInfo.getMch_id(), 
					weChatNotifyInfo.getOut_trade_no());
			
			log.info("微信回调信息:{}",weChatNotifyInfo);
		} catch (Exception e) {
			e.printStackTrace();
			log.error("微信回调异常:{}",e);
		}
		return resultMap;
	}
	
	
	
}
